package com.ruoyi.thesis.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.thesis.domain.thesis;
import com.ruoyi.thesis.service.IthesisService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 毕设管理Controller
 * 
 * @author juwujie
 * @date 2024-08-05
 */
@RestController
@RequestMapping("/thesis")
public class thesisController extends BaseController
{
    @Autowired
    private IthesisService thesisService;

    /**
     * 查询毕设管理列表
     */
    @RequiresPermissions("thesis:thesis:list")
    @GetMapping("/list")
    public TableDataInfo list(thesis thesis)
    {
        startPage();
        List<thesis> list = thesisService.selectthesisList(thesis);
        return getDataTable(list);
    }

    /**
     * 导出毕设管理列表
     */
    @RequiresPermissions("thesis:thesis:export")
    @Log(title = "毕设管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, thesis thesis)
    {
        List<thesis> list = thesisService.selectthesisList(thesis);
        ExcelUtil<thesis> util = new ExcelUtil<thesis>(thesis.class);
        util.exportExcel(response, list, "毕设管理数据");
    }

    /**
     * 获取毕设管理详细信息
     */
    @RequiresPermissions("thesis:thesis:query")
    @GetMapping(value = "/{thesisInfoId}")
    public AjaxResult getInfo(@PathVariable("thesisInfoId") Long thesisInfoId)
    {
        return success(thesisService.selectthesisByThesisInfoId(thesisInfoId));
    }

    /**
     * 新增毕设管理
     */
    @RequiresPermissions("thesis:thesis:add")
    @Log(title = "毕设管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody thesis thesis)
    {
        return toAjax(thesisService.insertthesis(thesis));
    }

    /**
     * 修改毕设管理
     */
    @RequiresPermissions("thesis:thesis:edit")
    @Log(title = "毕设管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody thesis thesis)
    {
        return toAjax(thesisService.updatethesis(thesis));
    }

    /**
     * 删除毕设管理
     */
    @RequiresPermissions("thesis:thesis:remove")
    @Log(title = "毕设管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{thesisInfoIds}")
    public AjaxResult remove(@PathVariable Long[] thesisInfoIds)
    {
        return toAjax(thesisService.deletethesisByThesisInfoIds(thesisInfoIds));
    }

}
